<template>
  <div class="header-box">
    <div class="h-center">
      {{ LabName }}
    </div>
    <div class="h-right">
      <div class="system" @click="changeCom"><img src="../../assets/images/change.png" alt=""></div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, ref, defineEmits } from "vue"
const LabName = ref('')
// 生命周期
onMounted(() => {
  const data = localStorage.getItem('info')
  if (data) {
    LabName.value = JSON.parse(data).LabName
  }
})
const emits = defineEmits(['changeCom'])
const changeCom = () => {
  emits('changeCom')
}
</script>

<style lang="scss" scoped>
.header-box {
  display: flex;
  height: 2rem;

  .h-center {
    flex: 1;
    display: flex;
    align-items: center;
    height: 2rem;
    position: relative;
    margin: 0 0.2rem;
    font-size: 1rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    /* 确保文本在一行内显示 */
    overflow: hidden;
    /* 隐藏溢出的内容 */
    text-overflow: ellipsis;
    /* 使用省略号表示文本溢出 */
  }

  .h-right {
    width: 3rem;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;

    .system {
      &:hover {
        color: #5084e4;
      }

      transition: all 0.3s;
      cursor: pointer;

      img {
        width: 20px;
        margin-right: 5px;
      }

      display: flex;
      align-items: center;
      margin-left: 10px;
    }
  }
}
</style>
